Repository navigation
Conversation
Thought again about interface vs abstract class. And ended up with an interface. I'm not sure how it exactly ends like, so maybe it will become an abstract class again. We'll find out Added SubCommandExample, it's an example for a command with subcommands.
Let's not talk about that :)
Thought again about interface vs abstract class. And ended up with an interface. I'm not sure how it exactly ends like, so maybe it will become an abstract class again. We'll find out Added SubCommandExample, it's an example for a command with subcommands.
…J-Bot into feature/command-system
| * <br> A second example will come for sub-commands. | ||
| * | ||
| */ | ||
| public interface ICommand { |
There was a problem hiding this comment.
| public interface ICommand { | |
| public interface Command { |
Starting interfaces with I is an old standard that I don't think we need to follow. Feel free to disregard if the group feels otherwise.
There was a problem hiding this comment.
We don't need to follow it yeah, following it has no downsides.
While it does have the upside of telling the user it's a interface.
Which is nice, since commands have to implement it, not extend it.
There was a problem hiding this comment.
We should anyway not make changes for such minor things, but I thing we should stick with a naming convention throughout the project.
There was a problem hiding this comment.
I'd also suggest sticking to common Java conventions. IIRC using I and comparable as prefix is more a thing for C-based languages.
There was a problem hiding this comment.
There's no Java convention telling you to not use or or use it ¯_(ツ)_/¯
Interface names should be capitalized like class names.
So by adding an I to the name, we are following Java conventions.
There was a problem hiding this comment.
Well yes, everything falls under that classification. Just saying that I've yet to see anyone code Java like that in the industry/higher education
There was a problem hiding this comment.
I don't really care so ig I'll change it
…#getCommandName and to the ICommand#getDescription method
|
What speaks against using already existing libraries that solve this problem? Out of my head I know of one, the thing is it uses annotations for it. The next question would be if all commands are created at compile time or if you want to be able to load them at runtime? As in, you have the bot framework that handles everything, and i.e. the "Ban"-Command could be updated outside of the bot and dynamically loaded. |
Yes, Chewtils a.e Those are fun for people that lack coding knowledge, or just want it to be easy and simple. But by creating something like this yourself, it's all educational for everyone, and it's fun + you have way more control
I'm not gonna bother creating anything like that, just restarting also works and is way simpler. |
|
I want this PR merged asap so there's a basis for people to work on. |
|
Has it been defined how you handle commands that are locked behind roles? Maybe thats a feature that you could include, or make it a separate interface |
|
I thought I mentioned this somewhere.. And yes I thought about it, I'm planning for making it easier to add command permissions in the future. Currently slash-command permissions are pretty shit, and Discord has confirmed on reworking them. (See Moderation -> "Revisit the permissions system to make it more flexible") So I'll wait until the rework, when the rework has been completed this will be added. |
|
Yes, I've read that comment, but wasn't aware it would be a limitation on role based filters? The bot would (probably) filter those, so such a system would be independent of discords slash command API? Unless, of course, you can define roles in the API for them |
|
The current slash-command permissions system works fully on roles. So right now you can just do Member#hasPermission instead Well, I don't see a reason to use roles besides because of Discord limitations. |
Basic command interface and examples (Together-Java#49)
|
May I ask, @Tais993 why did you not migrate the existing command to the "new" system? |
|
What existing commands, also this is probably better to be in the draft PR |
Adds a start of the command system. The Command interface has methods for the SlashCommandEvent, ButtonClickEvent and SelectionMenuEvent. The Command interface includes Javadoc, and there's 2 examples (SubCommandExample and CommandExample) This is still WIP but creates an foundation for others to work on.
Adds a start of the command system. The Command interface has methods for the SlashCommandEvent, ButtonClickEvent and SelectionMenuEvent. The Command interface includes Javadoc, and there's 2 examples (SubCommandExample and CommandExample) This is still WIP but creates an foundation for others to work on.
Adds a start of the command system. The Command interface has methods for the SlashCommandEvent, ButtonClickEvent and SelectionMenuEvent. The Command interface includes Javadoc, and there's 2 examples (SubCommandExample and CommandExample) This is still WIP but creates an foundation for others to work on.
Thought again about interface vs abstract class.
And ended up with an interface.
I'm not sure how it exactly ends like, so maybe it will become an abstract class again.
We'll find out
Added ICommand, the basic command interface all commands have to implement.
Added SubCommandExample, it's an example for a command with subcommands.
Added CommandExample, just a normal command example.
Opinions on the docs, or the code itself are welcome!
Hopefully this is alright so we will have this as basis for the branch.